<?php
Junction_FileCabinet::package("Junction_Utils_Resource");

class Test_Junction_Utils_Resource_Manager extends UnitTestCase {
	
	public function testConstruct() {
		try {
			$resource = new Junction_Utils_Resource_Manager($this);
		} catch (Exception $e) {
			$this->fail();
		}
		
		try {
			$resource = new Junction_Utils_Resource_Manager("foobar");
			$this->fail();
		} catch (Junction_Utils_Resource_Exception $e) {
			$this->pass();
		} catch (Exception $e) {
			$this->fail();
		}
	}
	
	public function testGetString() {
		$resource = new Junction_Utils_Resource_Manager($this);
		$this->assertTrue($resource->getString("foo") == "bar");
	}
	
	public function testIterator() {
		$resource = new Junction_Utils_Resource_Manager($this);
		$result = array();
		foreach ($resource as $key) {
			$result[] = $resource->getString($key);
		}
		$this->assertTrue(count($result) == 2);
	}
}
?>